/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package puntodeventa;

import com.mysql.jdbc.Connection;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.view.JasperViewer;

/**
 *
 * @author Lab
 */
public class Ticket {


    public static void tick() throws JRException,SQLException{
        Map mapa = new HashMap();
        mapa.put("suma", 33);
        mapa.put("nombre", "Oso de peluche");
        Connection c = (Connection) DriverManager.getConnection
                ("jdbc:mysql://localhost/Punto_de_Venta","root","root");
        JasperReport reporte= JasperCompileManager.compileReport("reportes/reporte1.jrxml");
         JasperPrint print =
        JasperFillManager.fillReport(reporte, mapa, c);
        JasperViewer visor = new JasperViewer(print,false);




          visor.setVisible(true);



     
 //visor. setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        // TODO code application logic here
    }

}
